#pragma once

#include "dshow.h"

class CDirectShowPlayer
{
public:
	CDirectShowPlayer(void);
	~CDirectShowPlayer(void);

public:
	bool SetOwnerWindow(HWND aHwnd);
public:
	bool OpenFile(wchar_t* aFileName);
	bool Close();

	bool Play();
	bool Stop();
	bool Pause();

	bool SeekForward();
	bool SeekReverse();

	int GetDuration();
	double GetCurrentPosition();
	bool SetCurrentPosition(double aPos);

	bool SetMute(bool abMute);
	long  GetVolume();
	bool SetVolume(long alVolume);

	bool CaptureBitmap(char *apBmpBuff,int aiBuffLen);

	bool SetVideoPosition(const RECT& rect);
	bool GetVideoSize(long *width,long *height);
	
private:
	IGraphBuilder			*mpGB;
	IMediaControl			*mpMC;
	IBasicAudio				*mpBA;
	IBasicVideo				*mpBV;
	IMediaSeeking			*mpMS;
	IMediaPosition			*mpMP;
	IVideoWindow			*mpVW;
	IMediaEventEx			*mpEvnt;	

	HRESULT hr;
};
